package com.github.niefy.modules.third.manage;

import com.github.niefy.common.utils.R;
import com.github.niefy.modules.third.entity.ThirdSysInfo;
import com.github.niefy.modules.third.service.ThirdSysInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 第三方系统信息管理
 */
@RestController
@RequestMapping("/third/thirdSysInfo")
@Tag(name = "第三方系统信息管理")
@RequiredArgsConstructor
@Slf4j
public class ThirdSysInfoManageController {

    private final WxMpService wxMpService;
    private final ThirdSysInfoService thirdSysInfoService;

    /*
    * 增
    * */
    @PostMapping("/manage")
    @Operation(summary = "添加第三方系统信息",description = "")
    public R save(HttpServletRequest request, HttpServletResponse response, @Validated ThirdSysInfo in) throws WxErrorException {
        thirdSysInfoService.save(in);
        return R.ok();
    }
    /*
     * 删
     * */
    @DeleteMapping("/manage")
    @Operation(summary = "删除第三方系统信息",description = "")
    public R delete(HttpServletRequest request, HttpServletResponse response, @Validated ThirdSysInfo in) throws WxErrorException {
        thirdSysInfoService.removeById(in);
        return R.ok();
    }
    /*
     * 改
     * */
    @PutMapping("/manage")
    @Operation(summary = "修改第三方系统信息",description = "")
    public R update(HttpServletRequest request, HttpServletResponse response, @Validated ThirdSysInfo in) throws WxErrorException {

        return R.ok();
    }
    /*
     * 查
     * */
    @GetMapping("/manage")
    @Operation(summary = "查询第三方系统信息",description = "")
    public R select(HttpServletRequest request, HttpServletResponse response, @Validated ThirdSysInfo in) throws WxErrorException {

        return R.ok();
    }
}
